| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkMemory::DeflateEncoder Class Reference

An encoder supporting Inflate/Deflate compression. More...

## Public Member Functions
| DeflateEncoder () noexcept
| DeflateEncoder (BitStream data) noexcept
| DeflateEncoder (BufferView<> data) noexcept
void | setDataStream (BitStream data)
void | setTransientOutput (BufferView<> output)
BufferView | decode ()
BufferView | decode (BufferView<> output)
bool | isDecodingDone () const

## Detailed Description

An encoder supporting Inflate/Deflate compression.

Note that currently, only decompression of pure raw streams (no gzip header) is supported.
Something to notice is that unlike other encoders offering free functions, this encoder needs to be instantiated as it needs to keep track of its status.

## Constructor & Destructor Documentation

## ◆ DeflateEncoder() [1/3]

nkMemory::DeflateEncoder::DeflateEncoder | ( |  | ) |
| noexcept

Default constructor.

## ◆ DeflateEncoder() [2/3]

nkMemory::DeflateEncoder::DeflateEncoder | ( | BitStream | data | ) |
| noexcept

Bitstream constructor.

Parameters

  data | The bitstream that should be used as input.

## ◆ DeflateEncoder() [3/3]

nkMemory::DeflateEncoder::DeflateEncoder | ( | BufferView<> | data | ) |
| noexcept

Parameters

  data | The buffer that should be used as input.

## Member Function Documentation

## ◆ setDataStream()

void nkMemory::DeflateEncoder::setDataStream | ( | BitStream | data | ) |

Sets the data stream to use as input.

Parameters

  data | The bit stream to use.

Remarks
  Setting the data stream switches the input the encoder will use, without altering other part of its status. This can be useful to decode a stream in chunks, provided the cunks stop at the block boundary. Use with care as an ongoing decoding could interpret wrongly new data, if the stream is not perfectly seamless.

## ◆ setTransientOutput()

void nkMemory::DeflateEncoder::setTransientOutput | ( | BufferView<> | output | ) |

Sets an output to populate through multiple decode(void) calls. The data will get appended each time a call is made, provided space is available.

Parameters

  output | The output to use.

Remarks
  Setting a transient output means that the output will be reused through multiple calls of decode(void). This can be useful when working with multiple stream chunks, for instance.

## ◆ decode() [1/2]

BufferView nkMemory::DeflateEncoder::decode | ( |  | ) |

Decodes the input stream, into the transient output registered.

Returns
  A view over the data that has been decoded through the call.

Remarks
  The decoding operation can end prematurely, depending on the input stream, and the output buffer. An incomplete input stream will return before the output is fully populated, while an output buffer that is too small will prevent from parsing the whole input stream.

## ◆ decode() [2/2]

BufferView nkMemory::DeflateEncoder::decode | ( | BufferView<> | output | ) |

Decodes the input stream, into the output buffer given as argument.

Parameters

  output | The output buffer to input to.

Returns
  A view over the data that has been decoded through the call.

Remarks
  The decoding operation can end prematurely, depending on the input stream, and the output buffer. An incomplete input stream will return before the output is fully populated, while an output buffer that is too small will prevent from parsing the whole input stream.

## ◆ isDecodingDone()

bool nkMemory::DeflateEncoder::isDecodingDone | ( |  | ) | const

Returns
  Whether the decoding is done, meaning that the last block has been encountered and processed (true) or not (false).

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsMemory/Compressions/DeflateEncoder.h